.class public Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;
.super Landroid/app/Dialog;
.source "DoubleChooserDialog.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog$OnSetListener;
    }
.end annotation


# instance fields
.field cancel:Landroid/widget/Button;

.field down:Landroid/widget/Button;

.field private fireAnalytics:Llt/noframe/gpsfarmguide/analytics/FireAnalytics;

.field name:Landroid/widget/TextView;

.field set:Landroid/widget/Button;

.field setListener:Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog$OnSetListener;

.field units:Landroid/widget/TextView;

.field up:Landroid/widget/Button;

.field width_holder:Landroid/widget/EditText;


# direct methods
.method public constructor <init>(Landroid/content/Context;Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog$OnSetListener;)V
    .locals 1

    .line 45
    invoke-direct {p0, p1}, Landroid/app/Dialog;-><init>(Landroid/content/Context;)V

    const/4 v0, 0x1

    .line 47
    invoke-virtual {p0, v0}, Landroid/app/Dialog;->requestWindowFeature(I)Z

    const v0, 0x7f0c006c

    .line 48
    invoke-virtual {p0, v0}, Landroid/app/Dialog;->setContentView(I)V

    const v0, 0x7f090282

    .line 50
    invoke-virtual {p0, v0}, Landroid/app/Dialog;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->units:Landroid/widget/TextView;

    const v0, 0x7f090294

    .line 51
    invoke-virtual {p0, v0}, Landroid/app/Dialog;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/EditText;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->width_holder:Landroid/widget/EditText;

    const v0, 0x7f090086

    .line 52
    invoke-virtual {p0, v0}, Landroid/app/Dialog;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/Button;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->up:Landroid/widget/Button;

    const v0, 0x7f090083

    .line 53
    invoke-virtual {p0, v0}, Landroid/app/Dialog;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/Button;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->down:Landroid/widget/Button;

    const v0, 0x7f090204

    .line 54
    invoke-virtual {p0, v0}, Landroid/app/Dialog;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/Button;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->set:Landroid/widget/Button;

    const v0, 0x7f09008d

    .line 55
    invoke-virtual {p0, v0}, Landroid/app/Dialog;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/Button;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->cancel:Landroid/widget/Button;

    .line 56
    new-instance v0, Llt/noframe/gpsfarmguide/analytics/FireAnalytics;

    invoke-direct {v0, p1}, Llt/noframe/gpsfarmguide/analytics/FireAnalytics;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->fireAnalytics:Llt/noframe/gpsfarmguide/analytics/FireAnalytics;

    const p1, 0x7f09018c

    .line 57
    invoke-virtual {p0, p1}, Landroid/app/Dialog;->findViewById(I)Landroid/view/View;

    move-result-object p1

    check-cast p1, Landroid/widget/TextView;

    iput-object p1, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->name:Landroid/widget/TextView;

    .line 58
    iput-object p2, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->setListener:Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog$OnSetListener;

    return-void
.end method

.method static synthetic access$000(Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;D)V
    .locals 0

    .line 22
    invoke-direct {p0, p1, p2}, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->addValue(D)V

    return-void
.end method

.method static synthetic access$100(Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;)Llt/noframe/gpsfarmguide/analytics/FireAnalytics;
    .locals 0

    .line 22
    iget-object p0, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->fireAnalytics:Llt/noframe/gpsfarmguide/analytics/FireAnalytics;

    return-object p0
.end method

.method private addValue(D)V
    .locals 5

    .line 141
    iget-object v0, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->width_holder:Landroid/widget/EditText;

    invoke-virtual {v0}, Landroid/widget/EditText;->getText()Landroid/text/Editable;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v1, ","

    .line 142
    invoke-virtual {v0, v1}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v2

    const-string v3, ""

    const-string v4, "."

    if-eqz v2, :cond_0

    invoke-virtual {v0, v4}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v2

    if-eqz v2, :cond_0

    .line 143
    invoke-virtual {v0, v1, v3}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;

    move-result-object v0

    .line 146
    :cond_0
    invoke-virtual {v0, v1, v4}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;

    move-result-object v0

    const-wide/16 v1, 0x0

    .line 148
    invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-nez v3, :cond_1

    .line 149
    invoke-static {v0}, Ljava/lang/Double;->valueOf(Ljava/lang/String;)Ljava/lang/Double;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Double;->doubleValue()D

    move-result-wide v1

    :cond_1
    add-double/2addr v1, p1

    .line 152
    new-instance p1, Ljava/text/DecimalFormat;

    const-string p2, "#0.00"

    invoke-direct {p1, p2}, Ljava/text/DecimalFormat;-><init>(Ljava/lang/String;)V

    .line 154
    invoke-static {}, Ljava/text/NumberFormat;->getInstance()Ljava/text/NumberFormat;

    move-result-object p2

    .line 156
    :try_start_0
    iget-object v0, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->width_holder:Landroid/widget/EditText;

    invoke-virtual {p1, v1, v2}, Ljava/text/DecimalFormat;->format(D)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {p2, v3}, Ljava/text/NumberFormat;->parse(Ljava/lang/String;)Ljava/lang/Number;

    move-result-object p2

    invoke-virtual {p2}, Ljava/lang/Number;->doubleValue()D

    move-result-wide v3

    invoke-static {v3, v4}, Ljava/lang/String;->valueOf(D)Ljava/lang/String;

    move-result-object p2

    invoke-virtual {v0, p2}, Landroid/widget/EditText;->setText(Ljava/lang/CharSequence;)V
    :try_end_0
    .catch Ljava/text/ParseException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception p2

    .line 158
    invoke-virtual {p2}, Ljava/text/ParseException;->printStackTrace()V

    .line 159
    iget-object p2, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->width_holder:Landroid/widget/EditText;

    invoke-virtual {p1, v1, v2}, Ljava/text/DecimalFormat;->format(D)Ljava/lang/String;

    move-result-object p1

    invoke-virtual {p2, p1}, Landroid/widget/EditText;->setText(Ljava/lang/CharSequence;)V

    :goto_0
    return-void
.end method


# virtual methods
.method public setTitle(Ljava/lang/CharSequence;)V
    .locals 1

    .line 64
    iget-object v0, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->name:Landroid/widget/TextView;

    invoke-virtual {v0, p1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    return-void
.end method

.method public show(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V
    .locals 3

    .line 70
    iget-object p1, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->width_holder:Landroid/widget/EditText;

    const/4 v0, 0x3

    invoke-virtual {p1, v0}, Landroid/widget/EditText;->setRawInputType(I)V

    .line 71
    iget-object p1, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->width_holder:Landroid/widget/EditText;

    invoke-virtual {p1, p2}, Landroid/widget/EditText;->setText(Ljava/lang/CharSequence;)V

    .line 73
    invoke-static {}, Ljava/text/NumberFormat;->getInstance()Ljava/text/NumberFormat;

    move-result-object p1

    .line 75
    :try_start_0
    iget-object v0, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->width_holder:Landroid/widget/EditText;

    invoke-virtual {p1, p2}, Ljava/text/NumberFormat;->parse(Ljava/lang/String;)Ljava/lang/Number;

    move-result-object p1

    invoke-virtual {p1}, Ljava/lang/Number;->doubleValue()D

    move-result-wide v1

    invoke-static {v1, v2}, Ljava/lang/String;->valueOf(D)Ljava/lang/String;

    move-result-object p1

    invoke-virtual {v0, p1}, Landroid/widget/EditText;->setText(Ljava/lang/CharSequence;)V
    :try_end_0
    .catch Ljava/text/ParseException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception p1

    .line 77
    invoke-virtual {p1}, Ljava/text/ParseException;->printStackTrace()V

    .line 78
    iget-object p1, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->width_holder:Landroid/widget/EditText;

    invoke-virtual {p1, p2}, Landroid/widget/EditText;->setText(Ljava/lang/CharSequence;)V

    .line 83
    :goto_0
    iget-object p1, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->units:Landroid/widget/TextView;

    invoke-virtual {p1, p3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 84
    iget-object p1, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->up:Landroid/widget/Button;

    new-instance p2, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog$1;

    invoke-direct {p2, p0}, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog$1;-><init>(Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;)V

    invoke-virtual {p1, p2}, Landroid/widget/Button;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 90
    iget-object p1, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->down:Landroid/widget/Button;

    new-instance p2, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog$2;

    invoke-direct {p2, p0}, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog$2;-><init>(Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;)V

    invoke-virtual {p1, p2}, Landroid/widget/Button;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 98
    iget-object p1, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->set:Landroid/widget/Button;

    new-instance p2, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog$3;

    invoke-direct {p2, p0, p3}, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog$3;-><init>(Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;Ljava/lang/String;)V

    invoke-virtual {p1, p2}, Landroid/widget/Button;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 125
    iget-object p1, p0, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;->cancel:Landroid/widget/Button;

    new-instance p2, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog$4;

    invoke-direct {p2, p0}, Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog$4;-><init>(Llt/noframe/gpsfarmguide/dialogs/DoubleChooserDialog;)V

    invoke-virtual {p1, p2}, Landroid/widget/Button;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 132
    invoke-virtual {p0}, Landroid/app/Dialog;->show()V

    return-void
.end method
